# encoding: utf-8
import re
import requests
import json
num = 0
session = requests.Session()
def gg(u):
    kv = {'User-Agent': 'yuanrenxue.project', 'cookie': 'sessionid=iym477mxcw9je2ygl98kklisawfgwp3o'}
    r = session.get(u, headers=kv,verify=False)
    rw = re.compile(r"'(.?)'")
    g = rw.findall(r.text)
    ck = ''
    for i in g:
        ck += i
    k2 = {'User-Agent': 'yuanrenxue.project'}
    session.cookies.set(ck.split('=')[0], ck.split('=')[1])
    for i in range(1, 6):
        t2(k2, 'https://match.yuanrenxue.com/api/match/13?page=' + str(i))


def t2(k, u1):
    global num
    r = session.get(u1, headers=k)
    l = json.loads(r.text)
    for i in l['data']:
        num += i['value']
gg('https://match.yuanrenxue.com/match/13')
